<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>重置密码 - 在线评测系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f5f7fa;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .recovery-container {
            width: 100%;
            max-width: 800px;
            background-color: #fff;
            border-radius: 5px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 40px;
        }

        .recovery-header {
            text-align: center;
            margin-bottom: 10px;
        }

        .recovery-header h1 {
            font-size: 24px;
            font-weight: 500;
            color: #333;
            margin-bottom: 10px;
        }

        .recovery-header p {
            font-size: 14px;
            color: #999;
            margin-bottom: 30px;
        }

        .steps-container {
            display: flex;
            justify-content: space-between;
            margin: 40px 20px 60px;
            position: relative;
        }

        .steps-container::before {
            content: '';
            position: absolute;
            top: 20px;
            left: 0;
            right: 0;
            height: 2px;
            background-color: #ddd;
            z-index: 1;
        }

        .step {
            display: flex;
            flex-direction: column;
            align-items: center;
            position: relative;
            z-index: 2;
        }

        .step-number {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #ddd;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-bottom: 10px;
            color: #fff;
            font-weight: bold;
        }

        .step.active .step-number {
            background-color: #1890ff;
        }

        .step.completed .step-number {
            background-color: #52c41a;
        }

        .step-label {
            font-size: 14px;
            color: #666;
        }

        .step.active .step-label {
            color: #1890ff;
        }

        .form-group {
            margin-bottom: 20px;
            display: flex;
            align-items: flex-start;
        }

        .form-group label {
            width: 120px;
            text-align: right;
            padding-right: 15px;
            color: #666;
            font-size: 14px;
            margin-top: 10px;
        }

        .form-group .input-container {
            flex: 1;
            position: relative;
        }

        .form-group .error-message {
            display: flex;
            align-items: center;
            color: #ff4d4f;
            margin-left: 20px;
            font-size: 14px;
        }

        .form-group .error-icon {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background-color: #fff2f0;
            color: #ff4d4f;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-right: 8px;
        }

        .form-group input {
            width: 100%;
            height: 38px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            padding: 8px 12px;
            font-size: 14px;
        }

        .form-group input:focus {
            outline: none;
            border-color: #40a9ff;
            box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
        }

        .btn {
            height: 38px;
            padding: 0 15px;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            border: none;
            transition: all 0.3s;
        }

        .btn-primary {
            background-color: #1890ff;
            color: #fff;
        }

        .btn-primary:hover {
            background-color: #40a9ff;
        }

        .form-actions {
            text-align: center;
            margin-top: 40px;
        }

        .form-actions .btn {
            width: 120px;
            height: 40px;
        }
    </style>
</head>
<body>
    <div class="recovery-container">
        <div class="recovery-header">
            <h1>找回密码</h1>
            <p>请设置您的新密码</p>
        </div>
        
        <div class="steps-container">
            <div class="step completed">
                <div class="step-number"><i class="fas fa-check"></i></div>
                <div class="step-label">身份验证</div>
            </div>
            <div class="step active">
                <div class="step-number">2</div>
                <div class="step-label">登录密码重置</div>
            </div>
            <div class="step">
                <div class="step-number">3</div>
                <div class="step-label">重置完成</div>
            </div>
        </div>
        
        <form id="resetPasswordForm">
            <div class="form-group">
                <label for="newPassword">新密码：</label>
                <div class="input-container">
                    <input type="password" id="newPassword" placeholder="请输入新密码">
                    <div class="error-message" id="passwordRuleError" style="display: none;">
                        <div class="error-icon"><i class="fas fa-exclamation"></i></div>
                        密码必须包含字母和数字，且不少于6位
                    </div>
                </div>
            </div>
            
            <div class="form-group">
                <label for="confirmPassword">确认密码：</label>
                <div class="input-container">
                    <input type="password" id="confirmPassword" placeholder="请再次输入新密码">
                </div>
                <div class="error-message" id="passwordError" style="display: none;">
                    <div class="error-icon"><i class="fas fa-exclamation"></i></div>
                    两次输入的密码不一致
                </div>
            </div>
            
            <div class="form-actions">
                <button type="button" class="btn btn-primary" id="nextStepBtn">下一步</button>
            </div>
        </form>
    </div>

    <script>
        // 密码验证
        const newPassword = document.getElementById('newPassword');
        const confirmPassword = document.getElementById('confirmPassword');
        const passwordError = document.getElementById('passwordError');
        const passwordRuleError = document.getElementById('passwordRuleError');
        const nextStepBtn = document.getElementById('nextStepBtn');
        
        // 检查密码是否符合要求（字母和数字组合，不少于6位）
        function isValidPassword(password) {
            return password.length >= 6 && /[a-zA-Z]/.test(password) && /\d/.test(password);
        }
        
        // 新密码输入验证
        newPassword.addEventListener('input', function() {
            const value = this.value;
            if (value && !isValidPassword(value)) {
                passwordRuleError.style.display = 'flex';
            } else {
                passwordRuleError.style.display = 'none';
            }
            
            // 如果确认密码已经输入，检查是否一致
            if (confirmPassword.value) {
                passwordError.style.display = (value !== confirmPassword.value) ? 'flex' : 'none';
            }
        });
        
        // 确认两次密码是否一致
        confirmPassword.addEventListener('input', function() {
            if (this.value && this.value !== newPassword.value) {
                passwordError.style.display = 'flex';
            } else {
                passwordError.style.display = 'none';
            }
        });
        
        // 表单提交
        nextStepBtn.addEventListener('click', function() {
            const password = newPassword.value;
            const confirm = confirmPassword.value;
            
            if (!password) {
                alert('请输入新密码');
                return;
            }
            
            // 检查密码是否符合要求
            if (!isValidPassword(password)) {
                passwordRuleError.style.display = 'flex';
                return;
            }
            
            if (password !== confirm) {
                passwordError.style.display = 'flex';
                return;
            }
            
            // 表单验证通过，提交到服务器
            // 模拟提交成功，跳转到成功页面
            window.location.href = 'reset-success.html';
        });
    </script>
</body>
</html> 